package com.kkb.mybatis.config;

import java.util.HashMap;
import java.util.Map;

/**
 * User: zsl
 * Date: 2019/10/1216:59
 * Description: 作用:存储sqlNode解析过程中产生的sql片段,
 * 并完成字符串拼接存储sqlNode解析过程中需要的入参信息
 */
public class DynamicContext {

    private StringBuilder sb = new StringBuilder();

    private Map<String,Object> initBindings = new HashMap<String, Object>();

    public DynamicContext(Object param) {
        initBindings.put("_initParameter",param);
    }

    public void appendSql(String sql){
        sb.append(sql);
        sb.append(" ");
    }

    public String getSql(){
        return  sb.toString();
    }

}
